package cn.wuwenyao.db.doc.generator.dao.impl.dbinfo.mysql;

import cn.wuwenyao.db.doc.generator.entity.TableFieldInfo;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

public class PgsqlTableFieldInfoRowMapper implements RowMapper<TableFieldInfo> {

@Override
public TableFieldInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
        TableFieldInfo tableFieldInfo = new TableFieldInfo();
        tableFieldInfo.setDefaultValue(rs.getString("column_default"));
        tableFieldInfo.setExtra("");
        tableFieldInfo.setField(rs.getString("column_name"));
        tableFieldInfo.setKey("");
        tableFieldInfo.setNullAble(rs.getString("is_nullable"));
        tableFieldInfo.setType(rs.getString("data_type"));
        tableFieldInfo.setRemark(rs.getString("description"));
        if (tableFieldInfo.getDefaultValue() == null) {
        tableFieldInfo.setDefaultValue("无");
        }
        if (tableFieldInfo.getRemark() ==null){
                tableFieldInfo.setRemark("");
        }
        return tableFieldInfo;
        }

        }